// JavaScript Document

$(function(){
    $.banner()
}); 

$(document).ready(function(e) {
	
    new FastClick(document.body);
  
$("#lm,.zhezhao2").tap(function(){
	  
	  $(".submenu").toggle();
	  $(".zhezhao2").toggle();
	  
	})
});
	
$.banner = (function() {
    var num = 0;
    num = $("#slider li").length;
    var html = "";
    html = "<a href='javascript:void(0);' {c}>{i}</a>";
    var lasthtml,
    thtml;
    lasthtml = "";


//修改内容
/*****/
/*$.ajax({
    type: "GET",
    url: " https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1f29e0e299d95462&redirect_uri=http://www.motuo88.cn/oauth2/wechatshop_template_home/platform/2/account/gh_a13c82ecf32a&response_type=code&scope=snsapi_base&state=p1#wechat_redirect",
    data: null,
    dataType: "json",
    success: function(data){
        //返回滚动条里的图片
        console.log(data);
    }

})*/
    var aLi = $("#slider img"); 
    /*for(var i=0; i<aLi.length;i++){
        if(i == 0 ){
         aLi[i].src="imgs/tp1.jpg"; //滚动图片  
        }else if(i == 1){
         aLi[i].src="imgs/tp2.jpg"; //images/video.jpg 
        }else if(i == 2){
         aLi[i].src="imgs/tp3.jpg"; //images/video.jpg 
        }
    }*/

    for (var i = 0; i < num; i++) {
        thtml = "";
        if (i == 0) {
            thtml = html.replace("{c}", "class='active' ");

        } else {
            thtml = html.replace("{c}", "");

        }
        thtml = thtml.replace("{i}", i);

        lasthtml += thtml;

    };
    $("#pagenavi").html(lasthtml);
    var active = 0,
    as = $('#pagenavi a');

    for (var i = 0; i < as.length; i++) {
        (function() {
            var j = i;
            as[i].onclick = function() {
                t2.slide(j);
                return false;
            }

        })();

    }

    var t2 = new TouchSlider({
        id: 'slider',
        speed: 600,
        timeout: 6000,
        before: function(index) {
            as[active].className = '';
            active = index;
            as[active].className = 'active';

        }
    });
	setTimeout(function(){t2.resize();},100);
});










